<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="frm.ssh.util.page.SearchBean"%>
<%@ include file="/jsp/common/common.jsp"%>
<html>
	<head>
		<script language="javascript" src="<%=contextPath%>/js/func.js"type=""></script>
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script>
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				        {
				            text: '查询',
				            icon:"<%=contextPath%>/images/query.gif",
				            handler:cmt
				        
				        },'-', 
				        {
				            text: '增加',
				            icon:"<%=contextPath%>/images/add.gif",
				            handler:function() {
				            	toDetail('0');
				            },
				            hidden:<%=session.getAttribute("btn_add_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        
				        },'-', 
				        {
				            text: '删除',
				            icon:"<%=contextPath%>/images/delete.gif",
				            handler:deleteIt,
				            hidden:<%=session.getAttribute("btn_delete_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        }
			    	]
			    });
			});
		</script>
	</head>
	<body>
		<div id ='tbar'></div>
		<form id="frmM" class="ct" name="frmM" method="POST" action="<%=contextPath%>/queryUser.do">
			<s:hidden name="pagetype" value ="dictype"/>
			<table width="100%" id="contab">
				<tr>
					<th class="ct">
						编号：
					</th>
					<td>
						<input type="text" name="searchBean.con2" id="searchBean.con2" value="${searchBean.con2}"/>
					</td>
					<th>
						名称：
					</th>
					<td>
						<input type="text" name="searchBean.con3" id="searchBean.con3" value="${searchBean.con3}"/>
					</td>
				</tr>
			</table>
			<hr>
			<table width="100%" id="listtab">
				<tr>
					<th class="ct" width="25">
						<input name="chkAll" type="checkbox" id="chkAll"
							onclick="javascript:checkAll(this.form, 'id');" value="checkbox">
					</th>
					<th class="lf" width="200">编号</th>
					<th class="ct" >名称</th>
				</tr>

				<c:forEach items="${list}" var="dictype" >
					<tr>
						<td class="ct">
							<input type="checkbox" name="id" value="${dictype.id}" />
						<br></td>
						<td class="lf">
								<a href="#" onClick="javascript:toDetail('<c:out value="${dictype.id}"/>')" /><c:out value="${dictype.typecode}"/></a><br>
						</td>
						<td class="ct"><c:out value="${dictype.typename}"/><br></td>
					</tr>
				</c:forEach>

				<c:if test="${list == null || fn:length(list) == 0 }">
					<tr>
						<td colspan="3" style="text-align: center">
							无相关记录
						</td>
					</tr>
				</c:if>
			</table>
			<table width="100%" id="tablestyle2">
				<tr>
					<td>
						<hr />
					</td>
				</tr>
				<tr>
					<td>${pageDown}</td>
				</tr>
			</table>
		</form>
	</body>
</html>
<script language="javascript">

			// 查询
			function cmt() {
				
				document.frmM.action = "<%=contextPath%>/dictypeList!getList.do?page=1&c=c";
				document.frmM.submit();
			}

			// 新建修改进入详细页面
			function toDetail(id){
				document.frmM.action = "<%=contextPath%>/dic!initDetail.do?id=" + id;
				uncheck("id");
				document.frmM.submit();
			}

			// 删除
			function deleteIt()
			{
				if(!isChecked("id")) {
		 			alert("请选择要删除的记录");
		 			return false;
		 		}
		    	if(confirm("确定要删除选中的记录吗？")) {
		        	document.frmM.action = "<%=contextPath%>/dic!delete.do?";
					document.frmM.submit();
		    	}
			}
			
		</script>